/**
 * Copyright (C) 2010-2011 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.seequencer.client;

import org.seequencer.client.instruments.TR909jsPresenter;
import org.seequencer.client.instruments.TR909jsView;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class App implements EntryPoint {
	
	
	public void onModuleLoad() {

		
		//a drum machine.
		TR909jsView tr909jsView = new TR909jsView();
		TR909jsPresenter tr909jsPresenter = new TR909jsPresenter(tr909jsView);
		
		//a instrument lane for the drum machine.
		InstrumentLaneView instrumentLaneView = new InstrumentLaneView();
		InstrumentLane instrumentLane = new InstrumentLane(instrumentLaneView);
		instrumentLaneView.setInstrumentLane(instrumentLane);
		
		instrumentLane.addInstrument(tr909jsPresenter);
		
		
		
		// second drum machine:
		TR909jsView tr909jsView2 = new TR909jsView();
		TR909jsPresenter tr909jsPresenter2 = new TR909jsPresenter(tr909jsView2);
		
		//a instrument lane for the drum machine.
		InstrumentLaneView instrumentLaneView2 = new InstrumentLaneView();
		InstrumentLane instrumentLane2 = new InstrumentLane(instrumentLaneView2);
		instrumentLaneView2.setInstrumentLane(instrumentLane2);
		
		instrumentLane2.addInstrument(tr909jsPresenter2);
		

		
		
		
		
		//a controller for the timing and so on:
		MasterControllerView masterControllerView = new MasterControllerView();
		MasterController masterController = new MasterController(masterControllerView);
		
		masterController.addInstrumentLane(instrumentLane);
		masterController.addInstrumentLane(instrumentLane2);
		
		
		
		
		//layouting:
		VerticalPanel mainPanel = new VerticalPanel();
		mainPanel.add(masterController.asWidget());
		
		mainPanel.add(instrumentLane.asWidget());
		mainPanel.add(tr909jsPresenter.asWidget());

		mainPanel.add(instrumentLane2.asWidget());
		mainPanel.add(tr909jsPresenter2.asWidget());
		
		RootPanel.get().add(mainPanel);
		
	}

}
